import 'package:flutter/material.dart';
import 'package:yyy_route_annotation/yyy_route_annotation.dart';
import 'package:flutter_syt/domain/widgets/news_card.dart';

@RoutePage(name: "testCardPage")
class TestCardPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _TestCardPageState();
}

class _TestCardPageState extends State<TestCardPage> {
  @override
  Widget build(BuildContext context) {
    List<NewsCardEntity> _list = [
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
      NewsCardEntity.fakeData(context),
    ];
    return Scaffold(
      body: SafeArea(
        child: GridView.count(
          crossAxisCount: 2,
          childAspectRatio: 1.0,
          padding: EdgeInsets.symmetric(horizontal: 8, vertical: 20),
          children: _list
              .map(
                (e) => Container(
                  padding: EdgeInsets.all(8),
                  child: NewsCard(e),
                ),
              )
              .toList(),
        ),
      ),
    );
  }
}
